package org.yly.game.rpggame.domain.model.player;

import java.util.List;
import java.util.Set;

import org.yly.game.rpggame.domain.model.DomainEventPublisher;
import org.yly.game.rpggame.domain.model.npc.Npc;

public class PlayerService {

	/**
	 * player1对player2使用技能skill
	 * 
	 * @param player1
	 * @param player2
	 * @param skill
	 */
	public void attack(Player player1, Player player2, String skillName) {
		player1.useSkill(skillName);
		player2.receivedSkill(skillName);
	}

	/**
	 * player1对player2使用技能skill
	 * 
	 * @param player1
	 * @param player2
	 * @param skill
	 */
	public void attack(Player player, Set<Player> playerSet, String skillName) {
		player.useSkill(skillName);
		for (Player p : playerSet) {
			p.receivedSkill(skillName);
		}
	}
	
	public List<String> touchNpc(Player player, Npc npc) {
			DomainEventPublisher.getInstance().publish(new PlayerTouchNpcEvent(player.id(), npc.id()));
		return npc.getDialogueList();
	}
	

}
